<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      li {
        list-style: none;
      }
      ul {
        overflow: hidden;
      }
      ul > li {
        float: left;
        width: 100px;
        height: 50px;
        text-align: center;
        line-height: 50px;
        font-size: 20px;
        border: 1px solid;
        cursor: pointer;
      }
      img {
        width: 200px;
        height: 200px;
      }

      .pink {
        background-color: pink;
      }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <ul>
        <li
          v-for="(item,index) in list"
          @click="show(index)"
          :class="{pink:index==num}"
        >
          {{item.name}}
        </li>
      </ul>
      <ol>
        <li v-for="(item,index) in list" v-show="index==num">
          <img :src="'image/'+item.imgUrl" alt="" />
        </li>
      </ol>
    </div>
    <script>
      const app = new Vue({
        el: "#app",
        data() {
          return {
            list: [
              { name: "1", imgUrl: "1.jpg" },
              {
                name: "2",
                imgUrl: "2.jpg",
              },
              { name: "3", imgUrl: "3.jpg" },
            ],
            num: 0,
          };
        },
        methods: {
          show(index) {
            this.num = index;
          },
        },
      });
    </script>
  </body>
</html>
